<?php
/**
 * Created by yuxianjun001@icloud.com.
 * User: wuchen
 * Date: 2019/3/26
 * Time: 19:51
 */

namespace App\Http\Controllers\Api\User;


use App\Http\Controllers\Common\MyController;
use App\Services\User\UserService;
use Illuminate\Http\Request;

class UserController extends MyController
{
    private $service;

    public function __construct()
    {
        $this->service = new UserService();
    }

    //用户注册，手机号，验证码
    public function register(Request $request)
    {

    }

    //创建token，新用户，或者刷新token 使用
    public function createToken(Request $request)
    {
        $res = $this->service->createToken($request);
        return $res;
    }

    //平台后端-增加用户
    public function addUser(Request $request)
    {
        $res = $this->service->addUser($request);
        return json_encode($res);
    }

    //平台后端-编辑用户
    public function editUser(Request $request)
    {
        $res = $this->service->editUser($request);
        return json_encode($res);

    }

    //平台后端-编辑用户
    public function delUser(Request $request)
    {
        $res = $this->service->delUser($request);
        return json_encode($res);

    }

    /**
     * 平台后端，商家后端登录
     * @param Request $request
     */
    public function loginByNameAndPwd(Request $request)
    {
        $res = $this->service->loginByNameAndPwd($request);
        return json_encode($res);
    }


}